package org.liveboardgames.agricola.control.delegates.mock.cards.actioncards
{
    import org.liveboardgames.agricola.control.delegates.mock.ActionFactory;
    import org.liveboardgames.agricola.model.enums.ActionOutputEnum;
    import org.liveboardgames.agricola.model.enums.ResourceZoneEnum;
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.agricola.vo.card.ActionCard;
    
    import mx.collections.ArrayCollection;
    
    public class PredefinedBoardCards
    {
        public static const THREE_WOOD:ActionCard = getThreeWoodCard();
        
        public static const ONE_CLAY:ActionCard = getOneClayCard();
        
        public static const ONE_REED:ActionCard = getOneReedCard();
        
        public static const ONE_FOOD:ActionCard = getOneFoodCard();
        
        private static function getThreeWoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Three Wood";
            card.resourceZone = ResourceZoneEnum.LEFT;
            
            // Build the actions
            var actions:ArrayCollection = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.WOOD, 3, true);
            action.target = card;
            action.needPlayerInput = false;
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            return card;
        }
        
        private static function getOneClayCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One Clay";
            card.resourceZone = ResourceZoneEnum.RIGHT;
            
            // Build the actions
            var actions:ArrayCollection = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.CLAY, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            return card;
        }
        
        private static function getOneReedCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One Reed";
            card.resourceZone = ResourceZoneEnum.LEFT;
            
            // Build the actions
            var actions:ArrayCollection = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.REED, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            return card;
        }
        
        private static function getOneFoodCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Fishing";
            card.resourceZone = ResourceZoneEnum.RIGHT;
            
            // Build the actions
            var actions:ArrayCollection = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.FOOD, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            // A peep can take all accumulated resources
            var takeAction:Action = ActionFactory.getTakeAllAction(card);
            actions.addItem(action);
            actions.addItem(takeAction);
            
            card.actions = actions;
            return card;
        }
    }
}